# -*- coding: utf-8 -*-

###########################################################################
# Python code generated with wxFormBuilder (version Aug  8 2018)
# http://www.wxformbuilder.org/
##
# PLEASE DO *NOT* EDIT THIS FILE!
###########################################################################

import os
import sys
import wx
import wx.xrc
from utils import FileDropTarget

###########################################################################
# Class MainWindow
###########################################################################


class MainWindow (wx.Frame):

    def __init__(self, parent):
        wx.Frame.__init__(self, parent, id=wx.ID_ANY,
                          title=u"文档转换助手 - v0.0.1", pos=wx.DefaultPosition,
                          size=wx.Size(500, 289),
                          style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
        self.SetBackgroundColour(wx.Colour(255, 255, 255))

        bSizer1 = wx.BoxSizer(wx.VERTICAL)

        self.m_staticText1 = wx.StaticText(
            self, wx.ID_ANY, u"拖放文档至下框，并点击转换按钮", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_staticText1.Wrap(-1)

        bSizer1.Add(self.m_staticText1, 0, wx.ALL, 5)

        self.text = wx.TextCtrl(
            self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
            wx.DefaultSize, style=wx.TE_MULTILINE | wx.HSCROLL)

        fd = FileDropTarget(self.text)
        self.text.SetDropTarget(fd)

        bSizer1.Add(self.text, 1, wx.ALL | wx.EXPAND, 5)

        bSizer2 = wx.BoxSizer(wx.HORIZONTAL)

        self.convert_btn = wx.Button(
            self, wx.ID_ANY, u"转换", wx.DefaultPosition, wx.DefaultSize, 0)
        # self.convert_btn.SetBackgroundColour(
            # wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DLIGHT))

        bSizer2.Add(self.convert_btn, 1, wx.ALIGN_BOTTOM |
                    wx.ALL | wx.EXPAND, 5)

        self.clear_btn = wx.Button(
            self, wx.ID_ANY, u"清空", wx.DefaultPosition, wx.DefaultSize, 0)
        # self.clear_btn.SetBackgroundColour(
            # wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DLIGHT))

        bSizer2.Add(self.clear_btn, 1, wx.ALL | wx.ALIGN_BOTTOM | wx.EXPAND, 5)

        bSizer1.Add(bSizer2, 0, wx.EXPAND, 5)

        self.SetSizer(bSizer1)
        self.Layout()

        self.Centre(wx.BOTH)

        # Connect Events
        self.convert_btn.Bind(wx.EVT_BUTTON, self.convert_func)
        self.clear_btn.Bind(wx.EVT_BUTTON, self.clear_func)

        self.SetIcon(wx.Icon(self.resource_path('k.ico')))

    def __del__(self):
        pass

    def resource_path(self, relative_path):
        base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
        return os.path.join(base_path, relative_path)

    # Virtual event handlers, overide them in your derived class
    def convert_func(self, event):
        event.Skip()

    def clear_func(self, event):
        event.Skip()
